#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int x, y;
	scanf("%2d%*4s%2d", &x, &y);
	printf("%d", y - x);
	return 0;
}